package com.jxnd.sunflower.controller;

import com.jxnd.sunflower.common.JSONResult;
import com.jxnd.sunflower.domain.RGoods;
import com.jxnd.sunflower.domain.dto.NavGoodsDTO;
import com.jxnd.sunflower.service.GoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: 敷衍
 * @description:
 * @date: 2021/12/2 18:19
 * @version: 1.0
 */
@Api(value = "商品",tags = "商品")
@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    @GetMapping("/status")
    @ApiOperation(value = "二手商品或全新",notes = "二手商品或全新")
    private JSONResult sendCode(@RequestParam Integer status){

        List<NavGoodsDTO> list = goodsService.selectNav(status);
        return new JSONResult(list);
    }


    @GetMapping("/id")
    @ApiOperation(value = "查询商品信息",notes = "查询商品信息")
    private JSONResult queryId(@RequestParam Integer id){

        RGoods rGoods = goodsService.queryInfo(id);
        return new JSONResult(rGoods);
    }
}
